package com.yzt.minemodule.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.module.LoadMoreModule;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.yzt.zhuju.network.entity.dynamic.DynamicListBean;
import com.yzt.zhuju.widget.tuiview.TUITextView;
import com.yzt.minemodule.R;
import com.yzt.plugin_imageloader.ImageLoadUtil;

/**
 * author : bob
 * date   : 2022/12/1
 * desc   : 用户页面的动态适配器
 */
public class UserDynamicAdapter extends BaseQuickAdapter<DynamicListBean, BaseViewHolder> implements LoadMoreModule {

    public UserDynamicAdapter() {
        super(R.layout.item_user_dynamic);
    }

    @Override
    protected void convert(BaseViewHolder holder, DynamicListBean item) {
        TUITextView like = holder.getView(R.id.tv_like);
        like.setSelected(item.isLiked());
        like.setText(""+ item.getLikeCount());
        if (item.getContentUrlList() != null && !item.getContentUrlList().isEmpty()) {
            ImageLoadUtil.loadAvatar(getContext(), item.getContentUrlList().get(0), holder.getView(R.id.iv_cover));
        }
    }
}
